package com.carryGo.filters.lt;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * ClassName:CharacterFilter
 * package:
 * Desription:
 *
 * @Date:2020/8/12 19:37
 * @Author: tank_李涛
 *//*
 *FileName:  CharacterFilter
 * Author:   28633
 * Date  :   2020/8/12 19:37
 * */
//过滤所有页面
@WebFilter("/*")
public class CharacterFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        //解决乱码问题
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        chain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}
